diff -u -r trilinos-12.4.2-Source-orig/packages/epetra/src/Epetra_LAPACK.cpp trilinos-12.4.2-Source/packages/epetra/src/Epetra_LAPACK.cpp
--- trilinos-12.4.2-Source-orig/packages/epetra/src/Epetra_LAPACK.cpp	2015-10-06 15:43:00.000000000 +0100
+++ trilinos-12.4.2-Source/packages/epetra/src/Epetra_LAPACK.cpp	2016-06-05 18:03:12.619388060 +0100
@@ -365,8 +365,11 @@
 			  double* A,  const int LDA,  double* B,  const int LDB,
                           double* ALPHA,  double* BETA,  double* U,  const int LDU, double* V, const int LDV, double* Q, const int LDQ, double* WORK, int* IWORK,
                           int* INFO) const {
-  DGGSVD_F77(CHAR_MACRO(JOBU), CHAR_MACRO(JOBV), CHAR_MACRO(JOBQ), &M, &N, &P, K, L,  A,  &LDA,  B,  &LDB,
-	     ALPHA,  BETA,  U,  &LDU, V, &LDV, Q, &LDQ, WORK, IWORK, INFO);
+  int LWORK;
+  LWORK = (3*N) > M ? 3*N : M;
+  LWORK = (LWORK > P ? LWORK : P) + N;
+  DGGSVD3_F77(CHAR_MACRO(JOBU), CHAR_MACRO(JOBV), CHAR_MACRO(JOBQ), &M, &N, &P, K, L,  A,  &LDA,  B,  &LDB,
+	     ALPHA,  BETA,  U,  &LDU, V, &LDV, Q, &LDQ, WORK, &LWORK, IWORK, INFO);
 }
 
 //=============================================================================
@@ -374,8 +377,11 @@
 			  float* A,  const int LDA,  float* B,  const int LDB,
                           float* ALPHA,  float* BETA,  float* U,  const int LDU, float* V, const int LDV, float* Q, const int LDQ, float* WORK, int* IWORK,
                           int* INFO) const {
-  SGGSVD_F77(CHAR_MACRO(JOBU), CHAR_MACRO(JOBV), CHAR_MACRO(JOBQ), &M, &N, &P, K, L,  A,  &LDA,  B,  &LDB,
-	     ALPHA,  BETA,  U,  &LDU, V, &LDV, Q, &LDQ, WORK, IWORK, INFO);
+  int LWORK;
+  LWORK = (3*N) > M ? 3*N : M;
+  LWORK = (LWORK > P ? LWORK : P) + N;
+  SGGSVD3_F77(CHAR_MACRO(JOBU), CHAR_MACRO(JOBV), CHAR_MACRO(JOBQ), &M, &N, &P, K, L,  A,  &LDA,  B,  &LDB,
+	     ALPHA,  BETA,  U,  &LDU, V, &LDV, Q, &LDQ, WORK, &LWORK, IWORK, INFO);
 }
 
 //=============================================================================
diff -u -r trilinos-12.4.2-Source-orig/packages/epetra/src/Epetra_LAPACK_wrappers.h trilinos-12.4.2-Source/packages/epetra/src/Epetra_LAPACK_wrappers.h
--- trilinos-12.4.2-Source-orig/packages/epetra/src/Epetra_LAPACK_wrappers.h	2015-10-06 15:43:00.000000000 +0100
+++ trilinos-12.4.2-Source/packages/epetra/src/Epetra_LAPACK_wrappers.h	2016-06-05 17:34:26.411666128 +0100
@@ -73,7 +73,7 @@
 #define DGETRS_F77  SGETRS
 #define DGGEV_F77   SGGEV
 #define DGGLSE_F77  SGGLSE
-#define DGGSVD_F77  SGGSVD
+#define DGGSVD3_F77 SGGSVD3
 #define DHSEQR_F77  SHSEQR
 #define DLAIC1_F77  SLAIC1
 #define DLAMCH_F77  SLAMCH
@@ -172,7 +172,7 @@
 #define DGETRS_F77  F77_BLAS_MANGLE(dgetrs,DGETRS)
 #define DGGEV_F77   F77_BLAS_MANGLE(dggev,DGGEV)
 #define DGGLSE_F77  F77_BLAS_MANGLE(dgglse,DGGLSE)
-#define DGGSVD_F77  F77_BLAS_MANGLE(dggsvd,DGGSVD)
+#define DGGSVD3_F77 F77_BLAS_MANGLE(dggsvd3,DGGSVD3)
 #define DHSEQR_F77  F77_BLAS_MANGLE(dhseqr,DHSEQR)
 #define DLAIC1_F77  F77_BLAS_MANGLE(dlaic1,DLAIC1)
 #define DLAMCH_F77  F77_BLAS_MANGLE(dlamch,DLAMCH)
@@ -227,7 +227,7 @@
 #define SGETRS_F77  F77_BLAS_MANGLE(sgetrs,SGETRS)
 #define SGGEV_F77   F77_BLAS_MANGLE(sggev,SGGEV)
 #define SGGLSE_F77  F77_BLAS_MANGLE(sgglse,SGGLSE)
-#define SGGSVD_F77  F77_BLAS_MANGLE(sggsvd,SGGSVD)
+#define SGGSVD3_F77 F77_BLAS_MANGLE(sggsvd3,SGGSVD3)
 #define SHSEQR_F77  F77_BLAS_MANGLE(shseqr,SHSEQR)
 #define SLAMCH_F77  F77_BLAS_MANGLE(slamch,SLAMCH)
 #define SLARFT_F77  F77_BLAS_MANGLE(slarft,SLARFT)
@@ -302,10 +302,10 @@
 			double * vr, const int * ldvr, double * work, const int * lwork, int * info);
   void PREFIX DGGLSE_F77(const int * m, const int * n, const int * p, double * a, const int * lda, double * b, const int * ldb,
 			 double * c, double * d, double * x, double * work, const int * lwork, int * info);
-  void PREFIX DGGSVD_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, const int * m, const int * n, const int * p, int * k, int * l,
+  void PREFIX DGGSVD3_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, const int * m, const int * n, const int * p, int * k, int * l,
 			 double * a, const int * lda, double * b, const int * ldb, double * alpha, double * beta,
 			 double * u, const int * ldu, double * v, const int * ldv, double * q, const int * ldq, double * work,
-			 int * iwork, int * info);
+			 int * lwork, int * iwork, int * info);
   void PREFIX DHSEQR_F77(Epetra_fcd job, Epetra_fcd, const int * n, const int * ilo, const int * ihi, double * h, const int * ldh,
 			 double * wr, double * wi, double * z, const int * ldz, double * work, const int * lwork, int * info);
   double PREFIX DLAMCH_F77(Epetra_fcd);
@@ -407,10 +407,10 @@
 			float * vr, const int * ldvr, float * work, const int * lwork, int * info);
   void PREFIX SGGLSE_F77(const int * m, const int * n, const int * p, float * a, const int * lda, float * b, const int * ldb,
 			 float * c, float * d, float * x, float * work, const int * lwork, int * info);
-  void PREFIX SGGSVD_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, const int * m, const int * n, const int * p, int * k, int * l,
+  void PREFIX SGGSVD3_F77(Epetra_fcd, Epetra_fcd, Epetra_fcd, const int * m, const int * n, const int * p, int * k, int * l,
 			 float * a, const int * lda, float * b, const int * ldb, float * alpha, float * beta,
 			 float * u, const int * ldu, float * v, const int * ldv, float * q, const int * ldq, float * work,
-			 int * iwork, int * info);
+			 int * lwork, int * iwork, int * info);
   void PREFIX SHSEQR_F77(Epetra_fcd job, Epetra_fcd, const int * n, const int * ilo, const int * ihi, float * h, const int * ldh,
 			 float * wr, float * wi, float * z, const int * ldz, float * work, const int * lwork, int * info);
   float PREFIX SLAMCH_F77(Epetra_fcd);
